//
//  CompanyBaseInfoModel.m
//  Btpin
//
//  Created by Vic on 2019/4/9.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "CompanyBaseInfoModel.h"

@implementation CompanyBaseInfoModel

- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
    self.id = [UIToolsControl dataAnalysis:keyedValues[@"id"]];
    self.logo = [UIToolsControl dataAnalysis:keyedValues[@"logo"]];
    
    self.full_name = [UIToolsControl dataAnalysis:keyedValues[@"full_name"]];
    self.short_name = [UIToolsControl dataAnalysis:keyedValues[@"short_name"]];
    self.nature = [UIToolsControl dataAnalysis:keyedValues[@"nature"]];
    self.nature_cn = [UIToolsControl dataAnalysis:keyedValues[@"nature_cn"]];
    self.finance = [UIToolsControl dataAnalysis:keyedValues[@"finance"]];
    self.finance_cn = [UIToolsControl dataAnalysis:keyedValues[@"finance_cn"]];
    self.district = [UIToolsControl dataAnalysis:keyedValues[@"district"]];
    self.district_cn = [UIToolsControl dataAnalysis:keyedValues[@"district_cn"]];
    self.trade = [UIToolsControl dataAnalysis:keyedValues[@"trade"]];
    self.trade_cn = [UIToolsControl dataAnalysis:keyedValues[@"trade_cn"]];
    self.scale = [UIToolsControl dataAnalysis:keyedValues[@"scale"]];
    self.scale_cn = [UIToolsControl dataAnalysis:keyedValues[@"scale_cn"]];
    self.contents = [UIToolsControl dataAnalysis:keyedValues[@"contents"]];
    self.tagStr = @"";
    self.tag = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"tag"] && [keyedValues[@"tag"] count]) {
        for (NSDictionary *dic in keyedValues[@"tag"]) {
            TagModel *model = [[TagModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.tag addObject:model];
            self.tagStr = [NSString stringWithFormat:@"%@,%@", model.tag_cn, self.tagStr];
        }
    }
    if (self.tagStr && self.tagStr.length>1) {
        self.tagStr = [self.tagStr substringToIndex:self.tagStr.length-1];
    }
    self.landline_tel = [UIToolsControl dataAnalysis:keyedValues[@"landline_tel"]];
    self.address = [UIToolsControl dataAnalysis:keyedValues[@"address"]];
    self.website = [UIToolsControl dataAnalysis:keyedValues[@"website"]];
    self.email = [UIToolsControl dataAnalysis:keyedValues[@"email"]];
    self.map_x = [UIToolsControl dataAnalysisForPrice:keyedValues[@"map_x"]];
    self.map_y = [UIToolsControl dataAnalysisForPrice:keyedValues[@"map_y"]];
    self.map_zoom = [UIToolsControl dataAnalysis:keyedValues[@"map_zoom"]];
    self.audit = [UIToolsControl dataAnalysis:keyedValues[@"audit"]];
    self.integrity_union = [UIToolsControl dataAnalysis:keyedValues[@"integrity_union"]];
    self.certificate_img = [UIToolsControl dataAnalysis:keyedValues[@"certificate_img"]];
    self.count_info = [[CountInfoModel alloc] init];
    if (keyedValues[@"count_info"]) {
        [self.count_info setValuesForKeysWithDictionary:keyedValues[@"count_info"]];
    }
    self.userinfo = [[HRInfoModel alloc] init];
    if (keyedValues[@"userinfo"]) {
        [self.userinfo setValuesForKeysWithDictionary:keyedValues[@"userinfo"]];
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

- (id)copyWithZone:(NSZone *)zone {
    CompanyBaseInfoModel *model = [[[self class] allocWithZone:zone] init];
    model.id = self.id;
    model.logo = self.logo;
    model.full_name = self.full_name;
    model.short_name = self.short_name;
    model.nature = self.nature;
    model.nature_cn = self.nature_cn;
    model.finance = self.finance;
    model.finance_cn = self.finance_cn;
    model.district = self.district;
    model.district_cn = self.district_cn;
    model.trade = self.trade;
    model.trade_cn = self.trade_cn;
    model.scale = self.scale;
    model.scale_cn = self.scale_cn;
    model.contents = self.contents;
    model.tag = [NSMutableArray arrayWithCapacity:0];
    if (self.tag && self.tag.count) {
        for (NSInteger i = 0; i < self.tag.count; i++) {
            [model.tag addObject:[self.tag[i] copy]];
        }
    }
    model.landline_tel = self.landline_tel;
    model.address = self.address;
    model.website = self.website;
    model.email = self.email;
    model.map_x = self.map_x;
    model.map_y = self.map_y;
    model.map_zoom = self.map_zoom;
    model.audit = self.audit;
    model.integrity_union = self.integrity_union;
    model.certificate_img = self.certificate_img;
    model.count_info = [[CountInfoModel alloc] init];
    model.count_info = [self.count_info copy];
    model.userinfo = [[HRInfoModel alloc] init];
    model.userinfo = [self.userinfo copy];
    
    return model;
}

@end
